

function ctrlInitArrowFormSelect(context,selector, data){
	var context = $(selector, context);

	$( ".checkbox-list", context).click(function(event){
		var ids = new Array();
		
		$(".checkbox-list", context).each(function(){
			var job = $(this) ;
			var checked = job.is(":checked");
			if( checked ) {
				ids[ ids.length ] = job.val() ;
			}
		});
		
		var newVal = ids.join(";").replace(";;", ";").replace(/^;/, "").replace(/;$/, "");
		$('input[name="'+data.name+'"]').val(newVal);
		
	});
	
	$( ".ctrl-checkbox-list-legend-title", context).click(function(event){
		if( $( '.ctrl-checkbox-list-list', context ).is(':hidden') )
			$( '.ctrl-checkbox-list-list', context ).show();
		else {
			if( data.selectedFn )
			try {
				window[data.selectedFn]( $('input[name="'+data.name+'"]').val() );
			} catch(e){
				alert('Bug w selectedFn');
			}	
		}
	});
		
		
	$('.ctrl-checkbox-list-roll', context ).click( function() {
		$( '.ctrl-checkbox-list-list', context ).toggle();
	});
	
	
	$( function() {
		var list = $('.ctrl-checkbox-list-list', context ) ;
		var legend = $('.ctrl-checkbox-list-legend', context ) ;
		
		list.css( "width", legend.width() - 20 ) ;
		list.css( "margin-top", -list.height() - legend.height() - 5 );
		
	} );
}